package com.zzq.controller;

import com.zzq.domain.entity.SmileCoupon;
import com.zzq.domain.entity.SmileCouponRule;
import com.zzq.domain.search.CouponRuleSerachParamet;
import com.zzq.domain.search.CouponSearchParamet;
import com.zzq.result.SmileResult;
import com.zzq.service.CouponAdminService;
import com.zzq.service.CouponRuleAdminService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RequestMapping("/admin/coupon")
@RestController
@Api(value = "票卷管理",tags = {"票卷管理"})
public class CouponAdminController {

    @Autowired
    CouponAdminService couponAdminService;
    @PostMapping("/list")
    @ApiOperation("获取列表")
    public SmileResult list(@RequestBody CouponSearchParamet serachParamet){
       return couponAdminService.getcouponDTOList(serachParamet);
    }

    @PostMapping("/add")
    @ApiOperation("添加列表")
    public SmileResult list(@RequestBody SmileCoupon coupon){
        return couponAdminService.addCoupon(coupon);
    }
    @GetMapping("/status/upd")
    @ApiOperation("更新票卷状态")
    public SmileResult list(@RequestParam("couponStatus") String couponStatus,@RequestParam("couponId")Long couponId){
        return couponAdminService.updCouponStatus(couponStatus,couponId);
    }
}
